package com.xzx.flink.streamapi.transform;

import com.xzx.flink.bean.ClickEvent;
import com.xzx.flink.streamapi.source.ClickSource;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @version 1.0
 * @auther xinzhixuan
 * @date 2022/4/17 21:45
 */
public class Transform_06_Shuffle {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        DataStreamSource<ClickEvent> streamSource = env.addSource(new ClickSource());
        streamSource.shuffle().print().setParallelism(4);// 没有任何的规律，随机分布

        env.execute(Transform_06_Shuffle.class.getSimpleName());
    }
}
